<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of LoggedInAs
 *
 * @author rampelli
 */
class Admin_View_Helper_LoggedInAs extends Zend_View_Helper_Abstract
{
    public function loggedInAs ()
    {
        $auth = Zend_Auth::getInstance();
        if ($auth->hasIdentity()) {
            $username = $auth->getIdentity()->username;
            $logoutUrl = $this->view->url(array('controller'=>'auth',
                'action'=>'logout'), null, true);
            return '<span class="note">Welcome, <a href="#" title="Welcome, '.ucfirst($username).'">'.ucfirst($username).'</a></span>
						<a class="btn ui-state-default ui-corner-all" href="#">
							<span class="ui-icon ui-icon-wrench"></span>
							Settings
						</a>
            			<a class="btn ui-state-default ui-corner-all" href="'.$logoutUrl.'">
							<span class="ui-icon ui-icon-power"></span>
							Logout
						</a>	';
           // return 'Welcome ' . $username .  '. <a href="'.$logoutUrl.'">Logout</a>';
        }

        $request = Zend_Controller_Front::getInstance()->getRequest();
        $controller = $request->getControllerName();
        $action = $request->getActionName();
        if($controller == 'auth' && $action == 'index') {
            return '';
        }
        $loginUrl = $this->view->url(array('controller'=>'auth', 'action'=>'index'));
        return '';
        return '<div class="loginheading">Login</div><div class="loginform">
          <input name="textfield" type="text" class="logininput" id="textfield" value="Donor Login" />
          <input name="textfield2" type="password" class="logininput" id="textfield2" value="password" />
          <input type="image" name="imageField" id="imageField" src="/template/default/images/loginbutton.gif" />
        </div>';
    }
    
    public function Login_url()
    {
    	$loginUrl = $this->view->url(array('controller'=>'auth', 'action'=>'index'));
    	return $loginUrl;
    }
}


?>
